Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Image Compression Manager Reference
Application-Defined Functions / Data-Loading Functions


MyDataLoadingProc

Your data-loading function should have the following form:

pascal OSErr MyDataLoadingProc (Ptr *dataP, long bytesNeeded, 
                                 long refcon);
dataP
Contains a pointer to the address of the data buffer. The decompressor uses this parameter to indicate where your data-loading function should return the compressed data. You establish this data buffer when you start the decompression operation. For example, the data parameter to the FDecompressImage function (described on page 3-79) defines the location of the data buffer for that operation. Upon return from your data-loading function, this pointer should refer to the beginning of the compressed data that you loaded.
The decompressor may also use this parameter to indicate that it wants to reset the mark within the compressed data stream. If the dataP parameter is set to nil, the bytesNeeded parameter contains the new mark position, relative to the current position of the data stream. If your data-loading function does not support this operation, return a nonzero result code.
bytesNeeded
Specifies the number of bytes requested or the new mark offset. If the decompressor has requested additional compressed data (that is, the value of the dataP parameter is not nil), then this parameter specifies how many bytes to return. This value never exceeds the size of the original data buffer. Your data-loading function should read the data from the current mark in the input data stream.
If the decompressor has requested to set a new mark position in the data stream (that is, the value of the dataP parameter is nil), then this parameter specifies the new mark position relative to the current position of the data stream.
refcon
Contains a reference constant value for use by your data-loading function. Your application specifies the value of this reference constant in the data-loading function structure you pass to the Image Compression Manager.
SPECIAL CONSIDERATIONS
The pointer in the dataP parameter must contain a 32-bit clean address within the data buffer. If you have dereferenced a handle, you should call the Memory Manager's StripAddress routine before passing it to the MyDataLoadingProc function.

RESULT CODES
noErr0No error
paramErr-50Invalid parameter specified
codecSpoolErr-8966Error loading or unloading data

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996